<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>媒体查询实战</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      @media screen and (min-width: 960px) {
        .div1 {
          width: 15%;
          height: 280px;
        }

        .div2 {
          width: 78%;
        }

        .div3 {
          width: 5%;
          height: 280px;
        }

        .div4 {
          width: 100%;
          height: 80px;
        }

        .div5 {
          width: 20%;
        }

        .div6 {
          width: 60%;
        }
      }

      @media screen and (max-width: 960px) {
        .div1 {
          width: 25%;
          height: 120px;
          margin-right: 5px;
        }

        .div2 {
          width: 38%;
          margin-right: 5px;
        }

        .div3 {
          width: 35%;
          height: 120px;
        }

        .div4 {
          height: 100px;
        }

        .div4,
        .div5,
        .div6 {
          width: 100%;
        }
      }

      @media screen and (max-width: 768px) {
        div[class*='div'] {
          width: 100%;
        }

        .div1,
        .div3 {
          border: 5px solid #999;
        }
      }

      .main {
        width: 960px;
        margin: 0 auto;
      }

      div[class*='div'] {
        float: left;
      }

      .div1 {
        background-color: palegreen;
      }
      .div2 {
        background-color: gray;
      }

      .div2 div {
        border: 5px solid #999;
      }

      .div3 {
        float: right;
        background-color: palevioletred;
      }

      .div4 {
        background-color: paleturquoise;
      }

      .div5 {
        height: 100px;
        background-color: peru;
      }

      .div6 {
        height: 100px;
        background-color: plum;
      }
    </style>
  </head>
  <body>
    <div class="main">
      <div class="div1"></div>
      <div class="div2">
        <div class="div4"></div>
        <div class="div5"></div>
        <div class="div5"></div>
        <div class="div6"></div>
        <div class="div6"></div>
        <div class="div5"></div>
        <div class="div5"></div>
      </div>
      <div class="div3"></div>
    </div>
  </body>
</html>
